﻿﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>订餐列表</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.8/css/sm-extend.min.css">
    <link href="//cdn.bootcss.com/font-awesome/4.5.0/css/font-awesome.css" rel="stylesheet" />
    <link href="/View_Mobile/CSS/szhlextend.css?ver=20160904" rel="stylesheet" />
    <link rel="stylesheet" href="/View_Mobile/CSS/animate.css">

    <style type="text/css">
        .ms-controller, [ms-controller] {
            display: none;
        }

        #plus_list {
            height: 2.65rem;
            width: 2.65rem;
            position: fixed;
            right: 0.82rem;
            bottom: 6rem;
        }

            #plus_list img {
                width: 100%;
                height: auto;
            }
    </style>
</head>
<body ms-controller="YDList">
    <div class="page-group">
        <div class="page page-current" id="pageindex1">
            <div class="buttons-tab">
                <a href="#" class="tab-link button external active">订餐管理</a>

            </div>

            <div class="content infinite-scroll infinite-scroll-bottom" data-distance="50" style="margin-top:2rem" id="touchcontent">
                <div class="list-container">

                    <div class="card facebook-card animated fadeInUp" ms-repeat-el="ctData">
                        <div class="ribbon-wrapper-green" style="width:65px;height:68px;top: -2px;right: -2px;"><div class="ribbon-green" style="top: 10px;width: 100px;    padding: 4px;font-size:11px">{{el.Status=='1'?'已接单':'未接单'}}</div></div>
                        <div class="card-header no-border" ms-on-click="showdetil(el)">
                            <div class="facebook-avatar"><img ms-src="/ViewV5/Base/DownFile.aspx?type=TX&user={{el.CRUser}}" style="border-radius: 3px;width:32px;height:32px"><div class="cadename" ms-if="!el.isfold">{{ComFunJS.convuser(el.CRUser)}}</div></div>
                            <div class="facebook-date" ms-if="el.isfold">{{ComFunJS.convuser(el.CRUser)}}</div>
                            <!--<div class="facebook-date">{{$.timeago(el.CRDate)}}</div>-->
                            <div class="facebook-date">{{el.CRDate|date("MM月dd日")}}</div>
                            <div class="facebook-date" ms-if="!el.isfold" style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">¥{{el.TTPrice.toFixed(2)}}</div>
                            <div class="facebook-date" ms-if="!el.isfold && el.Remark" style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{ComFunJS.bqhContent(covtitle(el.Remark))|html}}</div>
                        </div>
                        <div class="card-content  " ms-visible="el.isfold">
                            <div class="list-block media-list">
                                <ul ms-repeat-item="el.Item">
                                    <li class="item-content">
                                        <div class="item-media">
                                            <img ms-attr-src="'/ViewV5/Base/DownFile.aspx?fileId='+item.ImgUrl" style="width:80px;height:60px;">
                                        </div>
                                        <div class="item-inner">
                                            <div class="item-title-row">
                                                <div class="item-title">{{item.Name}}</div>
                                            </div>
                                            <div class="item-subtitle">
                                                <span style="color: #FF5151;"> ¥<span class="price">{{item.Price.toFixed(2)}}</span>/份</span>
                                                <span style="float: right;">{{item.Qty}}份</span>
                                            </div>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;" ms-if="el.Status=='1'"><span style="color:gray">已接单：</span>{{ComFunJS.convuser(el.QRUser)}}</div>
                            <div class="card-content-inner" style="padding-bottom:0;padding-top: 0.4rem;" ms-if="el.Status=='1' && el.Remark"><span style="color:gray">备注：</span> <span style="overflow: hidden; word-wrap: break-word; word-break: break-all; ">{{ComFunJS.bqhContent(el.Remark)|html}}</span></div>
                        </div>
                        <div class="card-footer no-border" style="display:-webkit-box;padding:0" ms-if="el.Status=='0' && type=='1'">
                            <a href="#" ms-click="jd(el)"><i class="fa fa-comment-o"></i>&nbsp;接单&nbsp;</a>
                        </div>
                    </div>
                    <div class="card facebook-card animated" ms-if="loadtip">
                        <div class="card-header no-border">
                            {{loadtip}}
                        </div>
                    </div>
                </div>
                <div class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
            </div>
            
            <span class="animated fadeIn" ms-if="DataID=='-1' && type!='1'" ms-click="addDC(1)" id="plus_btn" style="z-index:99998;opacity:.9"><img src="../images/plus_icon.png"></span>
            <span class="animated fadeIn" ms-if="DataID=='-1' && type!='1' && isadd" ms-click="addDC(2)" id="plus_btn" style="z-index:99998;opacity:.9"><img src="../images/pie-icon.png"></span>
            <span class="animated fadeIn" ms-if="DataID=='-1'" ms-click="changefold()" id="plus_list" style="z-index:99998;opacity:.9"><img ms-attr-src="'../images/'+(isfold?'rwglss':'rwglzk')+'.png'"></span>
            <!--<span class="animated fadeIn" ms-if="DataID=='-1'" ms-click="addCCXJ()" id="plus_btn" style="z-index:99998;opacity:.9"><img src="../images/plus_icon.png"></span>
            <span class="animated fadeIn" ms-if="DataID=='-1'" ms-click="changefold()" id="plus_list" style="z-index:99998;opacity:.9"><img src="../images/mes-today-icon.png"></span>-->

        </div>
        <div class="page" id="pageindex2">
        </div>
    </div>
    <script src="/View_Mobile/JS/layer/layer.m.js"></script>
    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.8/js/sm-extend.min.js' charset='utf-8'></script>
    <script src="/View_Mobile/JS/touch/toucher.js"></script>

    <script src="/View_Mobile/JS/avalon.mobile.min.js"></script>
    <script src="/View_Mobile/JS/ComFunJS.js?jsver=20160425"></script>
    <script>

        var model = avalon.define({
            $id: "YDList",
            ctData: [],//数据源
            loading: false,
            loadtip: "",//切换页时显示信息
            nowuser: ComFunJS.getnowuser(),//当前用户
            isfold: localStorage.getItem("dcglisfold") == "Y" ? true : false,//是否折叠显示
            changefold: function () {
                model.isfold = !model.isfold;
                model.ctData.forEach(function (item) {
                    item.isfold = model.isfold;
                })
                localStorage.setItem("dcglisfold", model.isfold ? "Y" : "N");
            },//改变折叠状态
            page: 1,
            pagecount: 8,
            type: 0,
            DataID: ComFunJS.getQueryString("ID", "-1"),//数据ID
            isadd:"",
            covtitle: function (title) {
                return ComFunJS.convstr($("<div>" + title + "</div>").text(), 20);
            },//转化 TITLE信息
            showdetil: function (item) {
                item.isfold = !item.isfold
            },//展开显示信息
            addDC: function (str) {
                //window.location = "/View_Mobile/UI/BASE/APP_MOBIL_WF.html?FormCode=KDGL&r=" + Math.random();
                window.location = "UI_DCGL_LIST.html?type=" + str + "&r=" + Math.random();
            },
            jd: function (el) {
                ComFunJS.showCommentNew(function (result) {

                    $.post("/API/VIEWAPI.ashx?Action=DCGL_QRSDDD&r=" + Math.random(), { "P1": el.ID, "P2": result.comment }, function (data) {

                        var r = $.parseJSON(data);
                        if (data.ErrorMsg == "") {
                            el.Status = r.Result.Status;
                            el.QRUser = r.Result.QRUser;
                            el.QRDate = r.Result.QRDate;
                            el.Remark = r.Result.Remark;
                            top.ComFunJS.winsuccess("接单成功！！");

                        }
                    })

                }, false, { type: "备注" });
            },
            loadMore: function () {
                if (model.loading) return;
                model.loading = true;
                $.getJSON("/API/VIEWAPI.ashx?Action=DCGL_GETDCGLLIST&r=" + Math.random(), { P1: model.type, "p": model.page, ID: model.DataID }, function (r) {
                    model.loading = false;
                    if (r.ErrorMsg == "") {
                        if (model.page == 1 && r.Result.length == 0) {
                            model.loadtip = '没有找到数据哦'
                        }
                        for (var i = 0; i < r.Result.length; i++) {
                            r.Result[i].isfold = model.isfold;
                            if (model.DataID != "-1") {//如果有数据ID，则展开显示
                                r.Result[i].isfold = true;
                            }
                        }

                        model.ctData.pushArray(r.Result);
                        //判断是否加载完毕
                        if (r.Result.length < model.pagecount) {
                            // 加载完毕，则注销无限加载事件，以防不必要的加载
                            $.detachInfiniteScroll($('.infinite-scroll'));
                            // 删除加载提示符
                            $('.infinite-scroll-preloader').remove();
                            return;
                        }
                        $.refreshScroller();
                        model.page += 1;
                    }

                });

            },
            viewfile: function (file) {
                ComFunJS.viewbigimg(this);
            },//文件查看方法
            getdata: function (type) {
                model.type = type;
                model.ctData.clear();
                model.page = 1;
                model.loadMore();
            }
        })
        avalon.ready(function () {
            if (model.DataID == "-1") {//如果参数中没有数据ID，则默认抓取当前用户数据
                model.type = 2;
            }
            $.getJSON("/API/VIEWAPI.ashx?Action=XTGL_GETCPROLE&r=" + Math.random(), {}, function (r) {
                if (r.ErrorMsg == "") {
                    if (r.Result == "Y") {
                        model.isadd = "Y";
                    }
                    if (r.Result1 == "Y") {
                        model.type = 1;
                    }
                }
                // 注册'infinite'事件处理函数
                $(document).on('infinite', '.infinite-scroll-bottom', function () {
                    model.loadMore();
                });

                $.init();
                model.getdata(model.type);
            })

        })
    </script>
</body>



</html>